<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.min.js"></script>
    <link rel="stylesheet" href="./css/inputNum.css">

</head>

<body>
    <div id="app">
        <input type="button" class="btn btn_minus" @click="sub">
        <span>{{num}}</span>
        <input type=" button " class="btn btn_plus" @click="add">
    </div>

</body>
<script>
    var VM = new Vue({
        el: '#app',
        data: {
            num: 1
        },
        methods: {
            add: function() {
                if (this.num < 10) {
                    this.num++;
                } else {
                    alert("别点了！最大了！");
                }
            },
            sub: function() {
                if (this.num > 0) {
                    this.num--;
                } else {
                    alert("别点了！最小了！");
                }
            }
        }
    })
</script>

</html>